<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>工程合同进度查询</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../../resources/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../resources/css/style.css" media="all">
    <style>
        .layui-form-label{width: 100px;}
        .layui-input-inline {width: 80%;}
    </style>
</head>
<body>
<a class="dayin" id="dlink" type="button"  style="float: right; position: fixed; right: 50px; bottom: 50px; z-index: 999;"></a>
<form class="layui-form layui-form-pane" id="form_7grid" action="" >
    <div class="formTop">
        <div class="layui-form-item layui-col-xs6 layui-col-sm3 layui-col-md3">
            <div class="layui-input-inline">
                <input type="text" name="username" lay-verify="required" placeholder="工程名称或合同号" autocomplete="off" class="layui-input">
            </div>
        </div>
        <div class="layui-inline layui-col-xs6 layui-col-sm3 layui-col-md3">
            <div class="layui-input-inline">
                <input type="text" class="layui-input" id="test-limit3" placeholder="请选择起始日期">
                <div class="icons">

                </div>
            </div>
        </div>
        <div class="layui-inline layui-col-xs6 layui-col-sm3 layui-col-md3">
            <div class="layui-input-inline">
                <input type="text" class="layui-input" id="test-limit4" placeholder="请选择结束日期">
                <div class="icons">

                </div>
            </div>
        </div>
        <div class="layui-col-xs6 layui-col-sm3 layui-col-md3">
            <button class="layui-btn" type="button"  onclick="query()">查询</button>
        </div>

    </div>
    <table id="demo" lay-filter="test"></table>
    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-sm" lay-event="edit">编辑</a>
        <a class="layui-btn layui-btn-danger layui-btn-sm" lay-event="detail">查看</a>
    </script>

</form>
<div id="demo7"></div>

<script src="../../../resources/layui/layui.js" charset="utf-8"></script>
<script src="../../../resources/js/style.js"></script>
<script src="../../../resources/js/api.js"></script>
<script>

    function query() {
        layui.use(['form', 'layedit', 'laydate','table','element'], function() {
            var form = layui.form
                , table = layui.table;
            var pronName=$("[name='username']").val();
            var begintime=$('#test-limit3').val();
            var endtime=$('#test-limit4').val();

        })
        API.contractSchedule({'p':getCookie('yanzheng'),'pronName':pronName,'begintime':begintime,'endtime':endtime})

    }
    layui.use(['form', 'layedit', 'laydate','table','element','laypage'], function(){
        var form = layui.form
            ,layer = layui.layer
            ,layedit = layui.layedit
            ,laydate = layui.laydate
            ,table=layui.table
            ,laypage=layui.laypage
            ,element=layui.element;

        jiazais();
        API.contractSchedule({'p':getCookie('yanzheng')});

        $('.close').click(function () {     //遮罩层隐藏
            $('.mask').hide();
        });

        $('.demoTable .layui-btn').on('click', function(){
            var type = $(this).data('type');
            active[type] ? active[type].call(this) : '';
        });
        //执行渲染


        //前后若干天可选，这里设置不能选过去的日期      最远可选1000天之后
        panduanshijian('#test-limit3','#test-limit4',1000,1000,'.layui-btn-normal');     //查询 开始结束时间判断
        dayintishi('.dayin');


        //监听工具条
        table.on('tool(test)', function(obj){ //注：tool是工具条事件名，test是table原始容器的属性 lay-filter="对应的值"
            var data = obj.data; //获得当前行数据
            var layEvent = obj.event; //获得 lay-event 对应的值
            var tr = obj.tr; //获得当前行 tr 的DOM对象

            if(layEvent === 'detail'){ //查看
                //do somehing

                sessionStorage.id=obj.data.cc_uuid;         //缓存id 至详情页调用
                window.location.href='./details.html';
            } else if(layEvent === 'del'){ //删除
                layer.confirm('确认删除？', function(index){
                    obj.del(); //删除对应行（tr）的DOM结构，并更新缓存
                    layer.close(index);
                    //向服务端发送删除指令
                });
            } else if(layEvent === 'edit'){ //编辑
                //do something
                sessionStorage.id=obj.data.cc_uuid;         //缓存id 至修改页调用
                window.location.href='./modify.html';

            }
        });



    })

</script>
</body>
</html>